/*
 * ParticleManager.h
 *
 *  Created on: 2009/02/17
 *      Author: Yongshik Cho
 */

#ifndef PARTICLEMANAGER_H_
#define PARTICLEMANAGER_H_

#include "core/ISingleton.h"
#include "ParticleObject.h"
#include "RibbonObject.h"

class ParticleManager : public ISingleton<ParticleManager>
{
public:
	static const String _DEFAULT_TEXTURE;

	static const uint8 PARTICLE_CUSTOM		= 0x0;
	static const uint8 PARTICLE_FIREWORKS	= 0x1;
	static const uint8 PARTICLE_FIRE		= 0x2;
	static const uint8 PARTICLE_SUN			= 0x3;
	static const uint8 PARTICLE_GALAXY		= 0x4;
	static const uint8 PARTICLE_FLOWER		= 0x5;
	static const uint8 PARTICLE_METEOR		= 0x6;
	static const uint8 PARTICLE_SPIRAL		= 0x7;
	static const uint8 PARTICLE_EXPLOSION	= 0x8;
	static const uint8 PARTICLE_SMOKE		= 0x9;
	static const uint8 PARTICLE_SNOW		= 0xA;
	static const uint8 PARTICLE_RAIN		= 0xB;

public:
	ParticleManager();
	virtual ~ParticleManager();

public:
	static ParticleManager& GetInstance()
	{
		assert(m_pInstance);
		return *m_pInstance;
	}
	static ParticleManager* GetInstancePtr()
	{
		return m_pInstance;
	}

public:
	void tick();

	inline const uint32 getParticleCount() const { return (uint32)mParticles.size(); }
	void addParticle(ParticleObject* particle);
	void subParticle(ParticleObject* particle);

	inline const uint32 getRibbonCount() const { return (uint32)mRibbons.size(); }
	void addRibbon(RibbonObject* ribbon);
	void subRibbon(RibbonObject* ribbon);

	ParticleObject* createParticle(const uint8 type);

private:
	ParticleObject* createFireworks();
	ParticleObject* createFire();
	ParticleObject* createSun();
	ParticleObject* createGalaxy();
	ParticleObject* createFlower();
	ParticleObject* createMeteor();
	ParticleObject* createSpiral();
	ParticleObject* createExplosion();
	ParticleObject* createSmoke();
	ParticleObject* createSnow();
	ParticleObject* createRain();

private:
	vector<ParticleObject*>		mParticles;
	vector<RibbonObject*>		mRibbons;
	uint32						mLastTime;
};

#endif /* PARTICLEMANAGER_H_ */
